package cn.kuick.match.test3;

public class Test3 {

	public static class LuomaConvert {
		private int[] nums;
		
		private int[] result;
		private int resultLen;
		
		public LuomaConvert(int[] nums) {
			this.nums = nums;
			
			this.resultLen = 0;
			this.result = new int[nums.length];
		}	
		
		public void cal() {
			 this.result = nums;
			 
			 for(int i=0; i<this.nums.length; i++) {
				 this.findSubS(i);
			 }
		}
		
		public void findSubS(int startIndex) {
			int tempLen = 0;
			int[] temp = new int[nums.length];
			temp[tempLen++] = this.nums[startIndex];
			
			 for(int i=startIndex + 1; i<this.nums.length; i++) {
				 int num = this.nums[i];
				 
				 if (num > temp[tempLen - 1]) {
					 temp[tempLen++] = num;
				 }  
			 }
			 
			 if (tempLen >= this.resultLen) {
				 this.resultLen = tempLen;
				 this.result = temp;
			 }
		}
		
		public void print() {
			System.out.print("�������: [");
			
			for (int i=0; i<resultLen; i++) {
				int dd = result[i];
				
				if (i == resultLen -1) {
					System.out.print(dd);
				} else {
					System.out.print(dd + ",");
				}
			}
			
			System.out.println("]������:" + resultLen);
		}
	}
	
	public static void convert(int[] nums) {
		LuomaConvert convert = new LuomaConvert(nums);
		convert.cal();
		convert.print();
	}
	
	public static void main(String[] args) {
		int[] input = {12, 8, 11, 3, 5, 10, 39, 29, 50, 2, 4, 100};
		convert(input);
	}
}
